package models;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

import play.db.jpa.Model;

@Entity
//@Table(uniqueConstraints = @UniqueConstraint(columnNames = { "numero", "partie" }))
public class Tour extends Model {
	Long numero;
	@ManyToOne
//	@Column(name="partie")
	Partie partie;
	// Fin du tour
	Date deadline;
	@OneToMany(mappedBy = "tour")
	Collection<Ordre> ordres;

	public Tour(Long numero, Partie partie, Date deadline) {
		this.deadline = deadline;
		this.partie = partie;
		this.numero = numero;
		this.ordres = new ArrayList<Ordre>();
	}
}
